package com.grass.appointment.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.OfficialBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.bumptech.glide.Glide;
import com.grass.appointment.C2694R;

public class OfficialAdapter extends BaseRecyclerAdapter<OfficialBean, Holder> {
    String domain;

    public String getDomain() {
        return this.domain;
    }

    public void setDomain(String str) {
        this.domain = str;
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
        ImageView imageView = holder.iv_cover;
        if (imageView != null) {
            Glide.with(imageView.getContext()).clear(imageView);
        }
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((OfficialBean) getDataInPosition(i), i);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C2694R.C2699layout.item_official, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        ImageView iv_man_girl;
        ImageView iv_official;
        TextView tv_address;
        TextView tv_content;
        TextView tv_name;

        private Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(C2694R.C2697id.iv_cover);
            this.iv_man_girl = (ImageView) view.findViewById(C2694R.C2697id.iv_man_girl);
            this.iv_official = (ImageView) view.findViewById(C2694R.C2697id.iv_official);
            this.tv_name = (TextView) view.findViewById(C2694R.C2697id.tv_name);
            this.tv_address = (TextView) view.findViewById(C2694R.C2697id.tv_address);
            this.tv_content = (TextView) view.findViewById(C2694R.C2697id.tv_content);
        }

        public void setData(OfficialBean officialBean, int i) {
            this.tv_name.setText(officialBean.getNickName());
            if (TextUtils.isEmpty(officialBean.getCityName())) {
                this.tv_address.setText("小草星");
            } else {
                TextView textView = this.tv_address;
                textView.setText(officialBean.getProvinceName() + "·" + officialBean.getCityName());
            }
            this.tv_content.setText(officialBean.getPersonSign());
            if (officialBean.getGender() == 1) {
                this.iv_man_girl.setImageResource(C2694R.C2696drawable.ic_girl);
            } else if (officialBean.getGender() == 2) {
                this.iv_man_girl.setImageResource(C2694R.C2696drawable.ic_man);
            } else {
                this.iv_man_girl.setImageResource(C2694R.C2696drawable.ic_man_girl);
            }
            if (officialBean.getBgImgs() == null || officialBean.getBgImgs().size() <= 0) {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadius(OfficialAdapter.this.domain + officialBean.getBgImgs().get(0), 4, this.iv_cover);
            }
            if (officialBean.isIsOfficial()) {
                this.iv_official.setVisibility(0);
            } else {
                this.iv_official.setVisibility(8);
            }
        }
    }
}
